<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <div class="box1">
        hello
    </div>
    <div class="box2">
        <b>world</b>
    </div>
    <input type="text" value="默认值" class="ipt">
</body>
<script>

    var box1 = document.getElementsByClassName("box1")[0];
    var box2 = document.getElementsByClassName("box2")[0];
    var ipt = document.getElementsByClassName("ipt")[0];

    console.log(box1.innerText);
    console.log(box2.innerText);
    
    console.log(box1.innerHTML);
    console.log(box2.innerHTML);

    console.log(ipt.innerText);
    console.log(ipt.innerHTML);
    console.log(ipt.value);

    box1.innerText = "abc"
    box2.innerText = "<i>qwe</i>"

    box2.innerHTML = "<i>qwe</i>"

    ipt.value = "<b>hahaha</b>"
    
</script>
</html>